package org.hzero.system.mapper;

import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.StringJoiner;

/**
 * @ClassName: PrimaryKeyUtil
 * @Description: 生成in查询条件
 * @author: tianhao.luo@hand-china.com
 * @date: 2020/11/28  10:39
 */
public final class KnifePrimaryKeyUtil {
    /**
     * 拼接主键
     * @param ids 主键内容
     * @return 主键
     */
    public static String getIds(List<Long> ids){
        if (CollectionUtils.isEmpty(ids)){
            return null;
        }
        StringJoiner stringJoiner = new StringJoiner(",");
        ids.forEach(id->stringJoiner.add(String.valueOf(id)));
        return stringJoiner.toString();
    }

}
